package com.ics.web.controller.travelstar.controller;

import com.ics.common.core.controller.BaseController;
import com.ics.common.core.domain.AjaxResult;
import com.ics.web.controller.travelstar.domain.TravelstarForm;
import com.ics.web.controller.travelstar.dto.TravelstarFormDTO;
import com.ics.web.controller.travelstar.service.TravelstarFormService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Arrays;

/**
 * @author shaoly
 * @description
 * @ClassName TravelstarFormController.java
 * @createTime 2024年12月05日 13:42:24
 */
@RestController
@RequestMapping("/tires/form")
@Api(value = "表单设计", tags = "表单设计接口")
public class TravelstarFormController extends BaseController {


    @Resource
    private TravelstarFormService formService;
    
    /**
     * 表单设计列表
     */
    @ApiOperation("表单设计列表")
    @GetMapping("/list")
    public AjaxResult list(TravelstarFormDTO formDTO) {
        return success(formService.listPage(formDTO));
    }


    /**
     * 表单设计详情
     */
    @ApiOperation("表单设计详情")
    @GetMapping(value = "/getInfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return success(formService.getById(id));
    }

    /**
     * 表单设计新增
     */
    @ApiOperation("表单设计新增")
    @PostMapping("/save")
    public AjaxResult save(@RequestBody TravelstarForm form) {
        return toAjax(formService.saveOrUpdate(form));
    }


    /**
     * 表单设计删除
     */
    @ApiOperation("表单设计删除")
    @PostMapping("/remove")
    public AjaxResult remove(@RequestParam("ids") String ids) {
        return toAjax(formService.removeByIds(Arrays.asList(ids.split(","))));
    }



}
